package redis

import "github.com/go-redis/redis"

func ExpirationData(key string) error {
	return RedisClient(func(rdb *redis.Client) error {
		result, err := rdb.TTL(key).Result()
		if err != nil {
			return err
		}

		if result <= 0 {
			return rdb.Del(key).Err()
		}

		return nil
	})
}
